package main

import (
	"fmt"
	"io"
	"net"
)

func main() {
	conn, err := net.Dial("tcp", "www.zybang.com:80")
	defer conn.Close()
	if err != nil {
		fmt.Println("conn remote server error.", err.Error())
		return
	}
	io.WriteString(conn, "GET / \n")
	hasMore := true
	data := make([]uint8, 4096)
	for hasMore {
		count, err := conn.Read(data)
		hasMore = (err == nil)
		fmt.Println(string(data[0:count]))
	}
}
